iT邦幫忙

2025 iThome 鐵人賽

DAY 3
0
DevOps

n8n x AI自動化之新手村系列 第 3

Day3 安裝n8n

  • 分享至 

  • xImage
  •  

今天這一篇文章要來用docker跑n8n,並且建立第一個Workflow!

Step 1 安裝docker

  1. 前往docker官網 https://www.docker.com/ 下載
  2. 點擊執行檔安裝
  3. 執行docker
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759p9hA9aUAD5.png

Step 2 安裝與Docker Compose&安裝n8n

  1. 建立一個資料夾 取名為n8n
  2. 在資料夾中新增文字文件,取名為docker-compose.yml
  3. 以記事本打開文件輸入
     volumes:
       n8n_storage:
     services:
       n8n:
         image: n8nio/n8n:latest
         restart: always
         ports:
           - "127.0.0.1:5678:5678"
         volumes:
           - n8n_storage:/home/node/.n8n
    
  4. 複製資料夾路徑
  5. 打開cmd,輸入cd <資料夾路徑>
  6. 輸入指令docjer compose up -d
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759AXuZaieTNK.png

Step 3 啟動n8n

  1. 進入官網輸入個人資料
  2. 在信箱收取啟動碼並填入系統中

注意!!由於是本地安裝,對於n8n來說是google是來路不明的,因此無法直接連到google等帳號做存取,也就是不會出現google的登入按鈕,可以按照以下步驟解決。

  1. 進入google cloud平台以取得通行證

  2. 新增專案並選取該專案
    https://ithelp.ithome.com.tw/upload/images/20250819/201687591jwNLdZAuv.png
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759P667jheB7c.png

  3. 選擇gmail API、google calenderAPI等等,點擊啟用 (這裡以gmail示範)
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759MOZFq9Xiuz.png

  4. 點選OAuth來允許授權
    https://ithelp.ithome.com.tw/upload/images/20250819/201687590g4nj5Itjv.png

  5. 設定目標對象(這裡先設定自己)
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759jZ9kxvrSPu.png

  6. 建立用戶端,並點選網頁應用程式
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759SjDvWy6Hoa.png

  7. 移到網頁最下面的「已授權的重新導向URI」,貼上從n8n頁面複製的「OAuth Redirect URL」

  8. 點擊建立後,會出現用戶端ID與用戶端密碼,複製下來回到n8n頁面
    https://ithelp.ithome.com.tw/upload/images/20250819/201687593CXtdp2GBW.png

  9. 就會出現google登入按鈕,按指示登入

建立第一個Workflow

建立一個觸發器,類似開關,只要啟動就會按照設定的步驟一步一步執行

  1. 首先建立手動觸發器
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759xRff3x7ZWc.png

  2. 雙擊點選後會出現設定頁面

  3. 點擊set mock data 建立資料內容

    1. 這些是JSON,n8n是以JSON為傳遞資料格式為基礎
      https://ithelp.ithome.com.tw/upload/images/20250819/20168759N0csCqVmbL.png
  4. 儲存後會顯示數據已被鎖定以方便做測試
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759OoVBLqHLwN.png

  5. 點下執行按鈕可以看到剛輸入的兩筆資料被送出
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759ZRTAtVkUYJ.png

  6. 點擊+號設定節點,選擇將資料送到何處,這裡選擇gmail的send message功能
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759bZKJW2LeYE.png

  7. 節點設定頁面

    1. 左側:目前節點接收到的資料
    2. 中間:設定登入與收件帳號、發送的主旨與內容(可拖曳左側的標籤)
    3. 右側:節點執行過後輸出的內容
      https://ithelp.ithome.com.tw/upload/images/20250819/20168759miS6vA0CV9.png
  8. 按下執行
    https://ithelp.ithome.com.tw/upload/images/20250819/20168759zkFxlZKr5g.png!

未完待續~


上一篇
Day2 什麼是n8n與AI自動化?
下一篇
Day4 n8n介面與功能介紹
系列文
n8n x AI自動化之新手村9
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言